<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>数组中的最大值和最小值</title>
  </head>
  <body>
    <script>
      /**
       * 获取数组中的最大值和最小值
       * */
      //方法一：Math.max(扩展运算符) Math.min(扩展运算符)
      let b = [1, 2, 3, 4, 5, 6];
      console.log(Math.max(...b));
      console.log(Math.min(...b));

      //方法二：Math.max.apply()  Math.min.apply()
      console.log(Math.max.apply(Math, b));
      console.log(Math.min.apply(Math, b));
    </script>
  </body>
</html>
